/***************************************************************************
 * Copyright (C) 2005 Global Biodiversity Information Facility Secretariat.
 * All Rights Reserved.
 *
 * The contents of this file are subject to the Mozilla Public
 * License Version 1.1 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of
 * the License at http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * rights and limitations under the License.
 ***************************************************************************/
package org.gbif.agi.oai.ipni;

import java.io.IOException;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;

import org.apache.commons.httpclient.HttpException;
import org.gbif.agi.RequestUtils;
import org.gbif.agi.oai.verb.ListRecords;
import org.xml.sax.SAXException;

/**
 * @author trobertson
 */
public class IPNIHarvester {
	public void harvest(String baseURL, String from, String prefix) {
		/*
		try {
			ListRecords listRecords = new ListRecords(baseURL, from, "", "", prefix);
			System.out.write(listRecords.toString().getBytes("UTF-8"));
			

		} catch (IOException e) {
			e.printStackTrace();
		} catch (ParserConfigurationException e) {
			e.printStackTrace();
		} catch (SAXException e) {
			e.printStackTrace();
		} catch (TransformerException e) {
			e.printStackTrace();
		}*/
		
		try {
			String response = RequestUtils.executeGetRequest("http://www.indexfungorum.org/ixfwebservice/fungus.asmx/AllUpdatedNames?startDate=20080101");
			System.out.println(response);
		} catch (HttpException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
	}
	
	public static void main(String[] args) {
		IPNIHarvester app = new IPNIHarvester();
		app.harvest("http://www.ipni.org/ipni-oai/oai", "2008-05-29T12:00:00Z", "oai_dc");
	}
}
